package org.jeecg.modules.courseplanatom.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.courseplanatom.entity.CouCoursePlanAtom;
import org.jeecg.modules.courseplanatom.mapper.CouCoursePlanAtomMapper;
import org.jeecg.modules.courseplanatom.service.ICouCoursePlanAtomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: cou_course_plan_atom
 * @author: baochangrong
 * @Date: 2022-02-17
 * @Version: V1.0
 */
@Service
public class CouCoursePlanAtomServiceImpl extends ServiceImpl<CouCoursePlanAtomMapper, CouCoursePlanAtom> implements ICouCoursePlanAtomService {

    @Autowired
    private CouCoursePlanAtomMapper couCoursePlanAtomMapper;

    @Override
    public IPage<CouCoursePlanAtom> queryAllPage(Page<CouCoursePlanAtom> page,CouCoursePlanAtom couCoursePlanAtom) {
        List<CouCoursePlanAtom> couCoursePlanAtomList = couCoursePlanAtomMapper.queryAllPage(page,couCoursePlanAtom);
        return page.setRecords(couCoursePlanAtomList);
    }

    @Override
    public List<CouCoursePlanAtom> coursePlanByCoursePlanId(String coursePlanId){
        List<CouCoursePlanAtom> couCoursePlanAtomList = couCoursePlanAtomMapper.coursePlanByCoursePlanId(coursePlanId);
        return couCoursePlanAtomList;
    }

    @Override
    /** 计划元素详情编辑 */
    public boolean planAtomEdit(CouCoursePlanAtom couCoursePlanAtom){
        boolean isCouCoursePlanAtom = couCoursePlanAtomMapper.planAtomEdit(couCoursePlanAtom);
        return isCouCoursePlanAtom;
    }

    @Override
    /** 计划元素详情新增 */
    public boolean planAtomAdd(CouCoursePlanAtom couCoursePlanAtom){
        boolean isCouCoursePlanAtom = couCoursePlanAtomMapper.planAtomAdd(couCoursePlanAtom);
        return isCouCoursePlanAtom;
    }

    /**
     * 升级教学计划详情
     * @param couCoursePlanAtom
     * @return
     */
    @Override
    public int insertUpgradeCouCoursePlanAtom(CouCoursePlanAtom couCoursePlanAtom){
        return couCoursePlanAtomMapper.insertUpgradeCouCoursePlanAtom(couCoursePlanAtom);
    }

}
